CC = gcc
COMPILE_FLAG = -O0 -Wall 
SRC_DIRECTORY := src
BUILD_DIRECTORY := bin
INCLUDES := -I include 

LIBS = -levent

all: libevent_test read_fifo write_fifo server client1 client2

libevent_test:
	@test -d $(BUILD_DIRECTORY) || mkdir $(BUILD_DIRECTORY)
	$(CC) -g -rdynamic $(INCLUDES)   $(COMPILE_FLAG)  -o $(BUILD_DIRECTORY)/libevent_test $(SRC_DIRECTORY)/libevent_test.c  $(LIBS)


read_fifo:
	@test -d $(BUILD_DIRECTORY) || mkdir $(BUILD_DIRECTORY)
	$(CC) -g -rdynamic $(INCLUDES)   $(COMPILE_FLAG)  -o $(BUILD_DIRECTORY)/read_fifo $(SRC_DIRECTORY)/read_fifo.c  $(LIBS)


write_fifo:
	@test -d $(BUILD_DIRECTORY) || mkdir $(BUILD_DIRECTORY)
	$(CC) -g -rdynamic $(INCLUDES)   $(COMPILE_FLAG)  -o $(BUILD_DIRECTORY)/read_fifo $(SRC_DIRECTORY)/write_fifo.c  $(LIBS)

server:
	@test -d $(BUILD_DIRECTORY) || mkdir $(BUILD_DIRECTORY)
	$(CC) -g -rdynamic $(INCLUDES)   $(COMPILE_FLAG)  -o $(BUILD_DIRECTORY)/server $(SRC_DIRECTORY)/server.c $(LIBS)

client1:
	@test -d $(BUILD_DIRECTORY) || mkdir $(BUILD_DIRECTORY)
	$(CC) -g -rdynamic $(INCLUDES)   $(COMPILE_FLAG)  -o $(BUILD_DIRECTORY)/client1 $(SRC_DIRECTORY)/client1.c $(LIBS)

client2:
	@test -d $(BUILD_DIRECTORY) || mkdir $(BUILD_DIRECTORY)
	$(CC) -g -rdynamic $(INCLUDES)   $(COMPILE_FLAG)  -o $(BUILD_DIRECTORY)/client2 $(SRC_DIRECTORY)/client2.c $(LIBS)